def judge(input):
    input = input.split(' ')
    inp = []
    conv = {'A': 1, 'J': 11, 'Q': 12, 'K': 13}
    for t in input:
        if t in conv:
            inp.append(conv[t])
        else:
            inp.append(int(t))

    def search(i, j):
        if i == j:
            return {t[i]}
        else:
            if j - i == 1:
                return {t[i] + t[j], t[i] - t[j], t[i] * t[j], t[i] / t[j]}
            else:
                out = set()
                for k in range(i, j):
                    ans1 = search(i, k)
                    ans2 = search(k + 1, j)
                    for q1 in ans1:
                        for q2 in ans2:
                            out.add(q1 + q2)
                            out.add(q1 - q2)
                            out.add(q1 * q2)
                            if q2 != 0:
                                out.add(q1 / q2)
                return out

    t = []
    def judge(t):
        out = search(0, 3)
        if 24 in out:
            return 'Yes'
        else:
            return 'No'

    used = [0, 0, 0, 0]

    def dfs(k):
        if k == 4:
            return judge(t)
        else:
            for i in range(4):
                if not used[i]:
                    t.append(inp[i])
                    used[i] = 1
                    ans = dfs(k + 1)
                    used[i] = 0
                    t.pop()
                    if ans == 'Yes':
                        return 'Yes'
            return 'No'

    return dfs(0)


input = 'A 5 5 5'
print(judge(input))
input = 'A A A A'
print(judge(input))
